package com.meeting.model.enums;

/**
 * 会议室状态枚举
 */
public enum MeetingRoomStatusEnum {
    FREE(0, "空闲"),
    LOCKED(1, "锁定"),
    RESERVED(2, "预定"),
    IN_USE(3, "使用"),
    MAINTENANCE(4, "维护");

    private final int code;
    private final String description;

    MeetingRoomStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static MeetingRoomStatusEnum fromCode(int code) {
        for (MeetingRoomStatusEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的会议室状态码: " + code);
    }
}